package cn.oa.service.impl;

import cn.oa.dao.DepartmentDao;
import cn.oa.dao.PositionDao;
import cn.oa.entity.Department;
import cn.oa.entity.Position;
import cn.oa.service.PositionService;
import cn.oa.util.SessionFatoryUtil;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.SQLException;
import java.util.List;

/**
 * @Description TODO
 * @Author hyl
 * @Date 2022/3/29 9:06
 **/
@Service("positionService")

public class PositionServiceImpl implements PositionService {
	@Autowired
	private PositionDao positionDao ;//= sqlSession.getMapper(PositionDao.class);
	@Override
	public List<Position> getAllPositions() throws SQLException {
		//SqlSession sqlSession = SessionFatoryUtil.getSqlSession();

		//PositionDao positionDao = sqlSession.getMapper(PositionDao.class);
		List<Position> list = positionDao.getAllPositions();

		//SessionFatoryUtil.closeSqlSession(sqlSession);
		return list;
	}

	public void setPositionDao(PositionDao positionDao) {
		this.positionDao = positionDao;
	}
}
